<?php

namespace api\modules\v1\controllers;

use Yii;
use common\models\TaskType;
use common\components\ETRestController;
use yii\data\ActiveDataProvider;

class TaskController extends ETRestController {

    //非固定任务
    public function actionTaskType() {
        $categories = TaskType::find()
                ->select('id,name')
                ->where('status=:status and is_fixed =:is_fixed', [':status' => TaskType::STATUS_ACTIVE, ':is_fixed' => 0])
                ->all();
        $typeArr = [];
        foreach ($categories as $category) {
            $typeArr[] = $category->toArray([], ['products']);
        }
        return $this->jsonSuccess(['types' => $typeArr]);
    }

}
